<include file="Public:header" />
<body>
<div class="main" >
	<div id="navigation"> &nbsp;当前位置 > 用户管理 > 
		<?php
			if($type=='user'){
				echo '业主管理';
			}elseif($type=='zsf'){
				echo '装师傅管理';
			}else{
				echo '公司管理';
			}
		?>
	</div>
	<div class="mainmenu"><a href="javascript:doAudit()">禁用</a>&nbsp;<a href="javascript:doUp()">启用</a>&nbsp;<a href="javascript:doTop(1)">置顶</a>&nbsp;<a href="javascript:doTop(0)">取消置顶</a>&nbsp;<a href="javascript:doRecom(1)">推荐</a>&nbsp;<a href="javascript:doRecom(0)">取消推荐</a>&nbsp;<a href="javascript:del()">删 除</a>&nbsp;&nbsp;</div>
	<table id="maintable">
		<tr>
			<th><input id="check" onclick="selectAll('sel','checkList');" type="checkbox" name="sel"></th><th>账 号</th><th>姓 名</th><th>Email</th><th>创建时间</th><th>标志</th><th>状态</th><th>操作</th>
		</tr>
		<volist name="list" id="vo">
			<tr>
			<td><input name="checkList[]" value="{$vo.id}" type="checkbox"></td>
			 <td>{$vo.account}</td>
			 <td>{$vo.name}</td>
			 <td>{$vo.email}</td>
			 <td>{$vo.ctime|date="Y-m-d",###}</td>
			 <td><?php echo $vo['istop']?'置顶':''; ?> &nbsp;&nbsp; <?php echo $vo['isrecom']?'推荐':''; ?></td>
			 <td><?php echo $vo['status']?'禁用':'启用'; ?></td>
			 <td><?php echo $vo['status']?'<a href="javascript:doUp('.$vo['id'].')"><img src="../Public/images/allow.gif" title="启用"/></a>':'<a href="javascript:doAudit('.$vo['id'].')"><img src="../Public/images/update.gif"  title="禁用"/></a>'; ?> &nbsp; <a href="__URL__/edit/id/{$vo.id}"><img src="../Public/images/b_edit.png" title="修改"/></a>&nbsp;&nbsp;<a href="javascript:del('{$vo.id}')"><img src="../Public/images/b_drop.png"  title="删除"/></a></td>
		  </tr>
	  </volist>
		
  </table>
  <div class="mainmenu">{$page}</div>
</div>
<script type="text/javascript">
function doTop(vo){
	var keyValue;
	
  keyValue = getSelectCheckboxValues();
	
	
	if (!keyValue)
	{
		alert('请选择要操作的对象！');
		return;
	}else{
		location.href = "__URL__/doTop/ist/"+vo+"/id/"+keyValue;
	}	
}
function doRecom(vo){
	var keyValue;
	
  keyValue = getSelectCheckboxValues();
	
	
	if (!keyValue)
	{
		alert('请选择要操作的对象！');
		return;
	}else{
		location.href = "__URL__/doRecom/ist/"+vo+"/id/"+keyValue;
	}	
}
function doAudit(id){
	var keyValue;
	if (id)
	{
		keyValue = id;
	}else {
		keyValue = getSelectCheckboxValues();
	}
	
	if (!keyValue)
	{
		alert('请选择要操作的对象！');
		return;
	}else{
		location.href = "__URL__/doAudit/id/"+keyValue;
	}	
}
function doUp(id){
	var keyValue;
	if (id)
	{
		keyValue = id;
	}else {
		keyValue = getSelectCheckboxValues();
	}
	
	if (!keyValue)
	{
		alert('请选择要操作的对象！');
		return;
	}else{
		location.href = "__URL__/doUp/id/"+keyValue;
	}	
}

function del(id){
	var keyValue;
	if (id)
	{
		keyValue = id;
	}else {
		keyValue = getSelectCheckboxValues();
	}
	if (!keyValue)
	{
		alert('请选择删除项！');
		return;
	}

	if (window.confirm('确实要删除选择项吗？'))
	{	
		
		location.href = "__URL__/delete/type/{$type}/id/"+keyValue;
	}
}

function getSelectCheckboxValues(){
	var obj = document.getElementsByName('checkList[]');
	var result ='';
	for (var i=0;i<obj.length;i++)
	{
		if (obj[i].checked==true)
				result += obj[i].value+",";

	}
	
	return result.substring(0, result.length-1);
}

 function selectAll(name,selectdName){


    	if($("input[name='"+name+"']").attr('checked')){

    		$("input[name='"+selectdName+"[]']").each(function(){
                $(this).attr('checked',true);
            });

    	}else{
    		$("input[name='"+selectdName+"[]']").each(function(){
                $(this).attr('checked',false);
            });

    	}
    }
</script>
</body>
</html>